package cn.javass.dp.iterator.example3;

public class Client {


    public static void main(String[] args) {
        PayManager payManager = new PayManager();
        payManager.calcPay();
        System.out.println("老公司工资结算-------");
        test(payManager.createIterator());

        SalaryManager salaryManager = new SalaryManager();
        salaryManager.calcSalary();
        System.out.println("新公司工资结算···········");
        test(salaryManager.createIterator());
    }

    private static void test(Iterator iterator) {
        iterator.first();
        while (!iterator.isDone()) {
            System.out.println("iterator = " + iterator.currentItem());
            iterator.next();
        }
    }
}
